<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>

<c:choose>
	<c:when test="${services1 != nul}">
		<h2>services where minCost &gt; ${serviceCost}</h2>
		<form class="form-horizontal">
          <div class="control-group">
            <label class="control-label" for="serviceCost" style="margin-right: 5px;">Service cost </label>
            <div class="input-append">
              <input type="text" id="serviceCost" placeholder="serviceCost" name="serviceCost" value="${serviceCost}">
              <input type="hidden" name="activeTab" value="q1" />
              <button class="btn" type="submit">Search!</button>
            </div>
          </div>
        </form>
		<p>${fn:escapeXml("#{ db.(Service where minServiceCost >= ")}${param['serviceCost']}${fn:escapeXml(")}")}</p>
		<table class="table table-hover">
			<thead>
				<tr>
					<th>Nazwa</th>
					<th>Opis</th>
					<th>Cena min</th>
					<th>Cena max</th>
					<th>Kategoria</th>
				</tr>
			</thead>
			<tbody>
				<c:forEach var="service" items="${services1}">
					<tr>
						<td>
							<c:out value="${service.serviceName}"/>
						</td>
						<td>
							<c:out value="${service.serviceDescription}"/>
						</td>
						<td>
							<fmt:formatNumber type="NUMBER" value="${service.minServiceCost}" maxFractionDigits="2" minFractionDigits="2" groupingUsed="false" />
						</td>
						<td>
							<fmt:formatNumber type="NUMBER" value="${service.maxServiceCost}" maxFractionDigits="2" minFractionDigits="2" groupingUsed="false" />
						</td>
						<td>
							<c:out value="${service.category.name}" />
						</td>
					</tr>
				</c:forEach>
			</tbody>
		</table>
	</c:when>
	<c:otherwise>
		<p>Sorry no data found ;(</p>
	</c:otherwise>
</c:choose>